#include "Connection.hpp"
#include "Common.h"



namespace tcplib
{
    Buffer::Buffer(size_t init_size)
        :_size(init_size),
        _rpos(0),
        _wpos(0)
    {
        _buf = new char[init_size];
    }

    Buffer::~Buffer()
    {
        delete[] _buf;
    }

    /*
    void Buffer::append(size_t size)
    {
        if (size > free_size())
            panic("Buffer append size should not greater than free_size");

        _wpos += size;
    }
    */

    void Buffer::readfd(int fd);


    void Buffer::readout(size_t size)
    {
        if (size > data_size())
            panic("Buffer append size should not greater than free_size");
        _rpos += size;
    }

    void Buffer::check_size()
    {
        if (free_size() > 1024) 
            return;

        if (_rpos > _size / 4) {
        }
    }

};
